import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { UserEntity } from './user.entity';

//图片
@Entity('images')
export class ImagesEntity {
  @PrimaryGeneratedColumn()
  id: number;
  @Column({ comment: '文件名称' })
  name: string;
  @Column({ comment: '保存路径' })
  url: string;
  @Column({ comment: '文件类型' })
  type: string;
  @CreateDateColumn({
    type: 'timestamp',
    comment: '图片创建日期',
    default: () => 'CURRENT_TIMESTAMP',
  })
  createdAt?: Date;
  @ManyToOne(() => UserEntity, user => user.images)
  user: UserEntity;
}

